fix: draining strategy fetch#5449
Open
nugaon wants to merge 2 commits into
Open
Conversation
Contributor
|
@nugaon, @sbackend123 already has a fix for this here. can you please review that first? |
7 tasks
Contributor
|
@nugaon can we have a rebase please? |
0709fae to
dbe655b
Compare
acud
approved these changes
May 28, 2026
| var ( | ||
| errStrategyNotAllowed = errors.New("strategy not allowed") | ||
| errStrategyFailed = errors.New("strategy failed") | ||
| errShouldNeverHappen = errors.New("should never happen") |
Contributor
There was a problem hiding this comment.
this is a sort of defensive programming that suggests that the code does not do proper error handling. if one cannot reason about values that function calls return, you end up in this sort of situation. i am approving just because i trust that the scope of the change is known (but also because this package is completely unreadable to me)
Contributor
|
Please add some description of what is done into this PR, more than just linking to the issue. |
Member
Author
|
I copied the summary from the issue, but the issue has all the details... so why the PR description is required? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #5448
runStrategyusesdefer cancel()with afor range cloop to drive chunk fetches. When the loop exits early (enough chunks fetched or too many failed),cancel()fires but goroutines already insideg.fetcher.Getcontinue running. These ghost goroutines from a failed DATA strategy mutate shared atomic countersg.failedCntandg.fetchedCntconcurrently with the subsequent RACE strategy, corrupting its accounting and causing it to terminate prematurely witherrStrategyFailedeven when enough parity chunks are available. Additionally,for range cnever terminates on its own sincecis never closed — the function can only exit via early returns.Checklist
Description
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
AI Disclosure